<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/8/12
 * Time: 10:46
 */

$i  = 0;                 //分割的块编号
$fp  = fopen("D:\文件处理\www.smachain.org.log","rb");      //要分割的文件
//$file = fopen("split_hash.txt","a");    //记录分割的信息的文本文件，实际生产环境存在redis更合适
while(!feof($fp)){
    $handle = fopen("./smachain.{$i}.log","wb");
    fwrite($handle,fread($fp,5242880));//切割的块大小 5m
   // fwrite($file,"hadoop.{$i}.sql\r\n");
    fclose($handle);
    unset($handle);
    $i++;
}
fclose ($fp);
//fclose ($file);
echo "ok";